package masterjava.common.util;

import masterjava.common.logging.ServerLogger;
import org.springframework.core.io.ClassPathResource;

import java.io.IOException;
import java.util.Properties;

/**
 * User: GKislin
 * Date: 15.04.11
 *
 * extended Properties
 */
public class Props extends Properties {

    protected static final ServerLogger LOGGER = ServerLogger.get(Props.class);

    public Props(String fileName) {
        load(fileName);
    }

    public void load(String fileName) {
        try {
            load(new ClassPathResource(fileName).getInputStream());
        } catch (IOException e) {
            throw LOGGER.getIllegalArgumentException(String.format("Properties file '%s' read error", fileName), e);
        }
    }
}
